//
//  String+Category.swift
//  DSWeiBo
//
//  Created by H on 16/5/31.
//  Copyright © 2016年 Mr.Lin. All rights reserved.
//

import UIKit

extension String{
    
    func cache() -> String {
        let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory,NSSearchPathDomainMask.UserDomainMask,true).last! as NSString
        return path.stringByAppendingPathComponent((self as NSString).lastPathComponent) as String
    }
    
    func docDir() ->String {
        let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory,NSSearchPathDomainMask.UserDomainMask,true).last! as NSString
        return path.stringByAppendingPathComponent((self as NSString).lastPathComponent) as String
    }
    
    func tmpDir() ->String {
        let path = NSTemporaryDirectory() as NSString
        return path.stringByAppendingPathComponent((self as NSString).lastPathComponent) as String
    }
}
